This invention relates to data processing and more particularly relates to apparatus for carrying out a microprogram within a data processor.
In most data processing systems, each machine operation is made up of a sequence of microprogram of microinstructions, such as transfers from memory to control or arithmetic registers, or vice-versa, and such as transfers from one register to another. In these systems, it has been common to use a series or sequence of microinstructions to carry out each machine operation as defined by a macroinstruction. The microinstructions are generally stored in a control read-only memory (CROM). Control logic enables a microinstruction or a group of microinstructions stored in CROM to execute a program memory instruction or macroinstruction. The CROM contents are similar to a group of subroutines which are called by the macroinstructions. Since a different series of microinstructions is stored for each different macroinstruction, the proper entry point to the CROM must be determined by the state of the data processor or the macroinstruction to be executed.
In conventional data processors, the operation code of the macroinstruction is used as a direct address of the CROM. This technique assumes that a routine in the microprogram is executed from an entry point corresponding to an instruction operation code and that every operation code has a unique entry point. Once an entry point is established, a number of words must be reserved in CROM for instruction execution. This number may be as high as eight, and if the processor uses a seven bit operation code (including the address) the total number of micro words would be 1024 (8.times.2.sup.7). According to this technique, the address of CROM would be represented by the notation (XXXXXXX 000).sub.2 in which the upper seven bits (i.e., the X's) directly correspond to the operation code. Because not all macroinstructions require eight micro words for execution, the CROM would contain blank words and would result in inefficient utilization.
Accordingly, it is the principal object of the present invention to provide microprogramming apparatus in which blank words in the memory storing the microinstructions are avoided or minimized. The applicant achieves this result by using a translator to convert each operation code to any required address in the CROM.
Since the function of the microprogram is to control the internal architecture of the processor, the microprogram must recognize the current state of the processor and take action corresponding to a particular state. Since come states have a higher priority than others, the microprogram also must be capable of recognizing and selecting the state with the highest priority. Accordingly, another object of the present invention is to provide improved apparatus for quickly and efficiently enabling the microprogram to select the macroinstruction having the highest priority for execution.
One of the principal purposes of the microprogram is to fetch and execute macroinstructions stored in the program memory of the processor. The fetching and executing of some macroinstructions may involve 40-50 microinstructions with various addressing modes, such as direct or indirect. Many of the macroinstructions require identical or closely related microinstructions for their execution. If the operation code of the macroinstruction is used as a direct address for CROM, the CROM must store the same microinstructions in connection with each different macroinstruction, thereby resulting in needless duplication and waste of CROM capacity.
Accordingly, it is another object of the present invention to provide improved apparatus which allows microinstruction sharing during the execution of different macroinstructions. The result can be achieved by dividing the requisite microinstructions into two different levels. On the first level, the microinstructions relating to the fetching of the operand called for by a macroinstruction are grouped. On the second level, the microinstructions relating to the arithmetic function applied to the operand are grouped. This organization can be achieved by providing a translator which generates two distinct addresses for each operation code stored in the instruction register. The first address points to the first level group of microinstructions and the second address points to the second level group of microinstructions. The microinstructions within the group can be sequentially executed by incrementing an address register for the CROM.
According to another feature of the invention, the microinstruction routines requiring branching can be performed by a translator such as a multiple address generator, capable of generating two distinct addresses for each operation code of a macroinstruction being executed.